package mshop.com.schild_kotlin.network

import okhttp3.Callback
import okhttp3.OkHttpClient
import okhttp3.Request

/**
 * Created by mayi on 2018/5/30.
 * @Autor CaiWF
 * @Email 401885064@qq.com
 * @TODO
 */
class Http302Util{
    var okHttpClient:OkHttpClient?=null

    init {
        okHttpClient=OkHttpClient.Builder().followRedirects(false).build()
    }


    /**
     * get请求，不带参数
     * @param url      请求地址
     * @param callback 回调监听
     */
    fun get(url: String, callback: Callback) {
        val request = Request.Builder().url(url).get().build()
        okHttpClient?.newCall(request)?.enqueue(callback)
    }
}